home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
parname.cq
/
parname.c
Wrap
Text File
|
1986-02-02
|
2KB
|
46 lines
/*
NAME
parnam
SYNOPSIS
parnam(name,path,fname);
char *name; filespec to parse
char path[FMSIZE]; path (including drive)
char fname[FNSIZE] filename with possible extension
DESCRIPTION
This routine parses a string (name) into a path and filename.
RETURNS
path is filled with any path specification (including drive)
fname is filled with the filename and possible extension
*/
/*
History:
Version Date Author Reason
------- -------- ------ ---------------------------------------------
1.0 01/15/85 CCW Original
*/
#include <dos.h>
parnam(name,path,fname)
char *name;
char *path;
char *fname;
{
int i,j;
/* Parse out the path portion of the filename */
for(i=strlen(name);
i >= 0 && name[i]!='/' && name[i]!=':' && name[i]!='\\';
i--);
/* i now should contain the length of the path */
if(i>0) stccpy(path,name,i+2);
else path[0]='\0';
i++;
for(j=0;j<FNSIZE && name[i] != '\0';j++) fname[j] = name[i++];
fname[j] = '\0';
}
fname[j] = '\0';
}